<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2021/5/24
 * Time: 15:20
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

declare(strict_types=1);

namespace app\common\lib;


class Random
{
    /**
     * 获取四位或者六位验证码
     * @param int $len
     * @return int
     */
    public static function randCode(int $len = 4): int
    {
        $rand = rand(1000, 9999);
        if ($len == 6) {
            $rand = rnad(100000, 999999);
        }
        return $rand;
    }
}